package demo6;

public class Category {
    private int categoryId;
    private String categoryName;
    private String categoryDescription;
    private boolean isDisabled;

    public Category(int categoryId, String categoryName, String categoryDescription, boolean isDisabled) {
        this.categoryId = categoryId;
        this.categoryName = categoryName;
        this.categoryDescription = categoryDescription;
        this.isDisabled = isDisabled;
    }

    // 添加分类
    public static Category addCategory(int categoryId, String categoryName, String categoryDescription, boolean isDisabled) {
        return new Category(categoryId, categoryName, categoryDescription, isDisabled);
    }

    // 修改分类
    public void modifyCategory(String categoryName, String categoryDescription, boolean isDisabled) {
        this.categoryName = categoryName;
        this.categoryDescription = categoryDescription;
        this.isDisabled = isDisabled;
    }

    // 删除分类
    public void deleteCategory() {
        this.categoryId = -1;
        this.categoryName = "";
        this.categoryDescription = "";
        this.isDisabled = true;
        System.out.println("分类已删除");
    }

    // 查询分类
    public void queryCategory() {
        System.out.println("分类编号: " + categoryId);
        System.out.println("分类名称: " + categoryName);
        System.out.println("分类说明: " + categoryDescription);
        System.out.println("是否停用: " + isDisabled);
    }
}